<?php
/**
 * Created by PhpStorm.
 * User: Mio
 * Date: 2017/10/13
 * Time: 17:38
 */

namespace app\index\model;


use think\Model;

class PraiseHide extends Model
{

    public function addPraiseHide($arr){
        if(!is_array($arr)) return false;
        $imgs = $arr['imgs'];
        unset($arr['imgs']);
        $r = $this->insertGetId($arr);
        if($r){
            if($imgs){
//                var_dump($imgs,$r);
                //添加图片
                $imgs = explode(',', $imgs);
                $img_arr = array();
                foreach ($imgs as $k => $v) {
                    $img_arr[$k]['praise_hide_id'] = $r;
                    $img_arr[$k]['img_url'] = $v;
                }
                model('PraiseHideImg')->addPraiseHideImg($img_arr);
            }

        }
        return $r;
    }
}